/* 
 * Copyright 2005-2010 Samuel Mello
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; version 2 of the License.
 * 
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 * 
 */

package datasoul.render;

import datasoul.DatasoulMainForm;
import datasoul.config.ConfigObj;

public class SwingDisplayFrame extends javax.swing.JFrame {

    /**
	 * 
	 */
	private static final long serialVersionUID = -2509069399889617587L;

	/** Creates new form SwingDisplayFrame */
    public SwingDisplayFrame() {
        initComponents();
        DatasoulMainForm.setDatasoulIcon(this);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        swingDisplayPanel1 = new datasoul.render.SwingDisplayPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setUndecorated(true);

        swingDisplayPanel1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                swingDisplayPanel1KeyTyped(evt);
            }
        });

        javax.swing.GroupLayout swingDisplayPanel1Layout = new javax.swing.GroupLayout(swingDisplayPanel1);
        swingDisplayPanel1.setLayout(swingDisplayPanel1Layout);
        swingDisplayPanel1Layout.setHorizontalGroup(
            swingDisplayPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        swingDisplayPanel1Layout.setVerticalGroup(
            swingDisplayPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(swingDisplayPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(swingDisplayPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void swingDisplayPanel1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_swingDisplayPanel1KeyTyped
        
    }//GEN-LAST:event_swingDisplayPanel1KeyTyped

    public void registerAsMain(){
        int w = ConfigObj.getActiveInstance().getMainOutputDeviceObj().getWidth();
        int h = ConfigObj.getActiveInstance().getMainOutputDeviceObj().getProportionalHeight(w);
        swingDisplayPanel1.initDisplay(w, h);
        ContentRender r = new ContentRender(w, h, swingDisplayPanel1.getContentDisplay());
        ContentManager.getInstance().registerMainRender(r);
    }

    public void registerAsMonitor(){
        int w = ConfigObj.getActiveInstance().getMonitorOutputDeviceObj().getWidth();
        int h = ConfigObj.getActiveInstance().getMonitorOutputDeviceObj().getProportionalHeight(w);
        swingDisplayPanel1.initDisplay(w, h);
        ContentRender r = new ContentRender(w, h, swingDisplayPanel1.getContentDisplay());
        ContentManager.getInstance().registerMonitorRender(r);
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private datasoul.render.SwingDisplayPanel swingDisplayPanel1;
    // End of variables declaration//GEN-END:variables

}

